#include <utestpp/UnitTest++.h>
#include <utestpp/AssertException.h>
#include <utestpp/ReportAssert.h>

TEST(ReportAssertThrowsAssertException)
{
    bool caught = false;

    try
    {
        int line = 0;
        UnitTest::ReportAssert("desc", "filename", line);
    }
    catch(UnitTest::AssertException const&)
    {
        caught = true;
    }

    CHECK (true == caught);
}

TEST(ReportAssertSetsCorrectInfoInException)
{
    const int lineNumber = 12345;
    const char* description = "description";
    const char* filename = "filename";

    try
    {
        UnitTest::ReportAssert(description, filename, lineNumber);
    }
    catch(UnitTest::AssertException const& e)
    {
        CHECK_EQUAL(description, e.what());
        CHECK_EQUAL("test.cpp", e.Filename());
        CHECK_EQUAL(lineNumber, e.LineNumber());
    }
}
